import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.os.Environment;

import io.flutter.embedding.android.FlutterActivity;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;

public class FileMethodCall  {
    public static final String FILE_CHANNEL = "cn.sduonline.isduflutter/file";

    public FileMethodCall(FlutterActivity activity) {
        super();
        new MethodChannel(activity.getFlutterView(), FILE_CHANNEL)
                .setMethodCallHandler(new MethodChannel.MethodCallHandler() {
                    //自己重写的方法代码。。。
                    public void onMethodCall(MethodCall methodCall, MethodChannel.Result result) {  // 分析 2
                        if (methodCall.method.equals("isChinese")) {
                            boolean isChinese = true;
                            result.success(isChinese);  // 分析3
                        } else {
                            result.notImplemented();
                        }
                    }
                });
    }
    public void Clipdata(){
        ClipboardManager clipboard = (ClipboardManager)
                getSystemService(Context.CLIPBOARD_SERVICE);
        ClipData clip = clipboard.getPrimaryClip();
        if (clip != null) {

            String text=null;
            String title=null;

            // Gets the first item from the clipboard data
            ClipData.Item item = clip.getItemAt(0);
            if (text == null) {
                text = item.coerceToText(this).toString();
            }
    }
}
}
